<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>初识Vue</title>
    <script src="../js/vue.js"></script>
</head>

<body>
    <div id="root">
        <h1>Hello,{{name}}</h1>
        <h1>Hello,{{msg}}</h1>
        <h1>Hello,{{user}}</h1>
    </div>
    <script>
        Vue.config.productionTip = false

        const vm = new Vue({
            el: '#root', //el用于指定当前Vue实例为哪个容器服务，值通常为css选择器字符串
            data: { // data中用于存储数据，数据供el所指定的容器去使用
                name: '尚硅谷'
            },
            computed: {
                //完整
                msg: {
                    get() {
                        return this.name
                    },
                    set() {
                        this.name = 'atshangguigu'
                    },
                },
                //简写 - 默认为get中的内容
                user() {
                    return this.name
                }
            }
        })
    </script>
</body>

</html>